/**
 * 数字包含
 */
public class test19 {
    public static void main(String[] args) {
        int count = 0;
        for (int i = 1 ; i<=2019 ; i++){
             int a = i;
             while (a!=0){
                 int b = a%10;
                 if (b == 9){
                     count++;
                     break;
                 }
                 a=a/10;
             }
        }
        System.out.println(count);
    }
}
